﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Text;
using System.Data;

namespace IHISCETeim.Web.MachineSys.FTradeModel
{
    public partial class ReportZhanLin1 : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "ReportZhanLin1";
            }
        }

        //protected DataTable GetJinXianShan
        //{
        //    get
        //    {
        //        return FTradeReportController.GetALLJinXiaoShang("");
        //    }
        //}

        protected string GetAllJingXiaoShan()
        {
            //营业经理权限 2014-02-21
            string agentList = base.FTradeAgentPowerSqlWhere();
            string wheresql = string.IsNullOrEmpty(agentList) ? " 1=1 " : string.Format(" JingXiaoShang in ({0})", agentList);

            wheresql += " and " + QueryOperatorsEnumHelper.ConvertCommonOperator("WeiShouKuanXiang", QueryOperatorsEnum.大于, "0");


            DataTable list = FTradeReportController.GetALLJinXiaoShang(wheresql);
            if (list.Rows.Count <= 0)
                return "";

            /// <ul><li><a href="JSDWF/JSDWFFolderPageList.aspx?ParFolderID=1" target="ajax" rel="jbsxBox">尿检</a></li></ul>
            StringBuilder sb = new StringBuilder();

            sb.Append("<ul>");
            //sb.Append("<li>");
            //sb.AppendFormat("<a href='#' onclick=\"gotoReportZhanLin1EasyUI('{0}')\">{2}.{1}</a>", "", "所有", 0);

            //// sb.Append(GetFolderTree(itm.FolderID));

            //sb.Append("</li>");

            int rowindex = 1;
            foreach (DataRow itm in list.Rows)
            {
                sb.Append("<li>");
                sb.AppendFormat("<a href='#' onclick=\"gotoReportZhanLin1EasyUI('{0}')\">{2}.{1}</a>", HttpUtility.UrlEncode(itm["JingXiaoShang"].ToString()), itm["JingXiaoShang"], rowindex);

                // sb.Append(GetFolderTree(itm.FolderID));

                sb.Append("</li>");
                rowindex++;
            }
            sb.Append("</ul>");

            return sb.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}